<?php
      $user = $_POST["user"];
	  $senha = $_POST["senha"];
			 	
				 
		
			
               
                        include "conecta.php";
						
						$consulta = mysql_query("select senha from login where usuario = '$user'");
						
						
						$sql = mysql_fetch_array($consulta);
						
						if ($sql) {
							if ($sql[0] != $senha) {
					       
			          
							header("location:index.php");
						     						
							
								}
							else {
							    	session_start();
				
				                    $_SESSION['user'] =  $user;
									$_SESSION['senha'] =  $senha;
                                   
								    header ("location: principal.php");
			
							   }
						
							}		
						else 
						     header("location:index.php"); 
?>
   
	 